Skip to content

Conversation

@wit765
Copy link
Contributor

@wit765 wit765 commented Nov 27, 2025

1. Fix bug

1.1 Issue

The function doCheckGenerate does not print the changed files as expected because the function HashFolder only iterate the following path:

  • .
  • .dockerignore
  • .git
  • .gitattributess

then exits.

1.2 Reason

After researching, I found the reason. The parameter exlude passed to the HashFolder function contains the directory .git. Then, when the filepath.WalkDir encounters the file .gitattributes, it returns the error filepath.SkipDir because the prefix contains. .git .Due to encountering the error 'filepath.WalkDir' in the root directory, it immediately stopped.

1.3 how to fix

return right error

  • return errorfilepath.SkipDir if it is an excluded directory
  • return nil if it is an excluded file

handle directory .github

Since the directory .github has prefix .git, so we use equal to check if it is an excluded path.

2. Optimize code

Move 'filepath. FromSlash' from function 'HashFolder' to function 'doCheckGenerate', reducing the number of calls from 18000 to 3 times.

3. Fix typos

Change exlude to excludes.

@wit765 wit765 changed the title build: fix make generate not print changed files build: fix do check generate not print changed files Nov 27, 2025
@wit765 wit765 changed the title build: fix do check generate not print changed files build: fix doCheckGenerate not print changed files Nov 27, 2025
@wit765 wit765 force-pushed the fix-do-generate branch 3 times, most recently from 0b53b67 to e29906f Compare November 27, 2025 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant